<?php  
class GlobalConfig extends DataObjectDecorator{     

    function extraStatics() {
        return array(
            'db' 		=> array(
                'GoogleAnalyticsScript' => 'Text',
                'UseSMTP' 				=> 'Boolean',
                'Host'					=> 'Varchar(255)',
                'Port' 					=> 'Varchar(20)',
                'Username' 				=> 'Varchar(255)',
                'Password' 				=> 'Varchar(255)',
                'AdminEmail' 			=> 'Varchar(255)',
                'UseSSL' 				=> 'Boolean',
                'FromName' 				=> 'Varchar(255)',
                'Footer'                => 'HTMLText',
            ),            
        );
    }

    public function updateCMSFields(FieldSet &$fields) { 
        $class = 'DHGlobalConfig';

        // Begin SMTPMailer
        $MailConfigTab = new Tab('MailConfig',
            new CheckboxField('UseSMTP', _t("$class.USESMTP", 'Use SMTP to send mail' )),
            new TextField("Host", _t("$class.HOST", 'Smtp host name')),
            new TextField("Port", _t("$class.PORT", 'Port'), '', 10),
            new TextField("Username", _t("$class.USER", 'Username')),
            new PasswordField("Password", _t("$class.PASS", 'Password')),
            new EmailField("AdminEmail", _t("$class.ADMINEMAIL", 'Admin email')),
            new CheckboxField('UseSSL', _t("$class.USESSL", 'Use SSL (with GMAIL account)')),
            new TextField("FromName", _t("$class.FROMNAME", 'From Name'))
        );        
        $fields->addFieldToTab('Root', $MailConfigTab);

        $footerTab = new Tab('Footer',
                new HtmlEditorField('Footer')
            );
        $fields->addFieldToTab('Root', $footerTab);
    }

}    
?>